<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <script>
        var A=function(){
            this.getName=function(){
                return 'z3';
            }
        }
        var a=new A();

        var B=function(){
            //B依赖于a
            document.write(a.getName());
        }
        var b=new B();

        //用到js的2个方法
        //1.将a传入到B里面去
        //2.a是全局变量
    </script>
</body>
</html>